#include <bits/stdc++.h>
using namespace std;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
using ll = long long;
class Solution
{
public:
    string findCommon(string s1, string s2)
    {
        int i = 0;
        int len = min(s1.size(), s2.size());
        while (i < len && s1[i] == s2[i])
        {
            i++;
        }
        return s1.substr(0, i);
    }
    string longestCommonPrefix(vector<string> &strs)
    {
        string ret = strs[0];
        for (int i = 1; i < strs.size(); ++i)
        {
            ret = findCommon(ret, strs[i]);
        }
        return ret;
    }
};
